--- import Button from '$components/Button.astro'; import CommitteeList from '$components/CommitteeList/CommitteeList.astro'; import NewsIndex from '$components/NewsIndex/NewsIndex.astro'; import translate from '$i18n/translate'; import tPage from '$i18n/translations/pages/home'; import Page from '$layouts/Page.astro'; import localeStaticPaths from '$lib/localeStaticPaths'; import { isBefore, isNewsItemInLocale } from '$lib/newsUtils'; import type Locale from '$types/Locale'; import { getCollection } from 'astro:content'; export async function getStaticPaths() { return localeStaticPaths; } const locale = Astro.params.locale as Locale; const t = translate(locale); const allNewsItemsInLocale = await getCollection('news', (item) => isNewsItemInLocale(item, locale) ); const firstNewsItem = allNewsItemsInLocale.find( (item) => !allNewsItemsInLocale.some((otherItem) => isBefore(item, otherItem)) ); if (!firstNewsItem) { throw new Error('No first news item.'); } ---